<template>
  <div id="app">
    <p>count {{ $store.state.count }} 奇偶数?:{{ $store.getters.addOrEven }}</p>
    <button @click="addOne">+</button>
    <button @click="dleOne">-</button>
    <button @click="addAdd">奇数+</button>
    <button @click="addTime">延时+</button>
  </div>
</template>

<script>
// import { mapState, mapActions, mapMutations, mapGetter } from "vuex";

export default {
  name: "App",
  methods: {
    addOne() {
      // this.$store.dispatch("addCount");
      //不需要使用actions 可以直接使用commit
      this.$store.commit("ADDCOUNT");
    },
    dleOne() {
      this.$store.dispatch("dleCount");
    },
    addAdd() {
      //可以给store传一个参数
      this.$store.dispatch("adda");
    },
    addTime() {
      this.$store.dispatch("addTime");
    },
  },
  components: {},
};
</script>

<style>
</style>
